<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="app">hello</div>
    <script>
        const data = {
            msg: 'Hello world',
            count: 80
        }

        const vm = new Proxy(data, {
            get(target,key){
                return target[key]
            },
            set(target, key, newValue){
                if(target[key] === newValue){
                    return
                }
                target[key] = newValue
                document.getElementById('app').textContent=target[key]
            }
        })
        vm.msg = 'hello world'
        console.log(vm.msg)
        
    </script>
</body>
</html>